//
//  TeleportObstacle.m
//  StarBugs
//
//  Created by ?? ? on 3/22/12.
//  Copyright 2012 antisword@playorca.com. All rights reserved.
//

#include "Object/TeleportObstacle.h"
#include "Util/ImageManager.h"

using namespace cocos2d;
 

TeleportObstacle::TeleportObstacle(int type)
{

    mainSprite = ImageManager::getSpriteWithXml2(kImagesheet_GameSource, "warp_1");
    //    mainSprite->setScale(0.8);
    addChild(mainSprite);
    if(type == 0)
        objectType = objectType_teleport1;
    else if(type == 1)
        objectType = objectType_teleport2;
    else 
        objectType = objectType_teleport3;
    
}

void TeleportObstacle::setBody(b2World *world)
{
    mainSprite->setPosition(position);
    mainSprite->setRotation(bodyAngle);
}


void TeleportObstacle::setBodyAngle(bool isInv)
{
    if(isInv)
        bodyAngle += 10;
    else
        bodyAngle -= 10;
    
    mainSprite->setRotation(bodyAngle);
}